﻿using System;
using System.Collections.Generic;

namespace Teigha.Core
{
	public class MemoryTransaction
	{
		public MemoryTransaction()
		{
			this.ObjList = new List<IDisposable>();
		}

		public void AddObject(IDisposable newObj)
		{
			if (newObj != null)
			{
				this.ObjList.Add(newObj);
			}
		}

		public void DeleteObjects()
		{
			for (int i = this.ObjList.Count; i > 0; i--)
			{
				this.ObjList[i - 1].Dispose();
			}
		}

		private List<IDisposable> ObjList;
	}
}
